package com.hww.service;

import com.hww.spring.MyApplicationContext;

/**
 * @author: heweiwei
 * @time: 2025/4/28 20:31
 * @description:
 */
public class Test {

    public static void main(String[] args) {
        MyApplicationContext context = new MyApplicationContext(AppConfig.class);
        
        // First time: will create the bean
        UserService userService1 = (UserService) context.getBean("userService");
        userService1.sayHello();
        
        // Second time: will return the cached instance
        UserService userService2 = (UserService) context.getBean("userService");
        userService2.sayHello();
        
        // Verify it's the same instance
        System.out.println("Same instance: " + (userService1 == userService2));
    }
}
